#include "StdAfx.h"
#include "VFieldEditor.h"

// VFieldEditor ///////////////////////////////////////////////////////////////

//
VFieldEditor::VFieldEditor(QWidget *widget)
	:QLineEdit(widget)
{
}

//
VField VFieldEditor::field()
{
	m_field.setValue(text());
	return m_field;
}

//
void VFieldEditor::setField(const VField &f)
{
	m_field = f;
	
	if (m_field.fontPtr())
		setFont(*m_field.fontPtr());
		
	//setReadOnly(true);
	setText(f.value().toString());
	//deselect();
	//setCursorPosition(0);
	//setSelection(0,1);
}

//
void VFieldEditor::focusInEvent(QFocusEvent *e)
{
	QLineEdit::focusInEvent(e);
	deselect();
}
